<script>
$(document).ready(function(e) {
	var page=1;
	$('#tukhoa').keyup(function(e) {
       search()
    });
	<?php
	foreach($category as $v)
		{
			if(is_array($v))
			{
	?>
		$('#<?php echo $lib->maketitle($v['title']);?>').click(function(e) {
		   search();
		});
	<?php
		}
	 }
    ?> 
	
	function search()
	{
		$('#callpro').html('<p style="text-align:center"><img src="<?php echo $url_dir; ?>images/loading.gif"></p>');
		$.post('<?php echo $url; ?>getnews.php?n='+page,$('#frmSearch').serialize(),function(data){
			if(!$.trim(data)){
				alert('Dữ liệu trống !');
			}
			else{
				$('#callpro').html(data);
			}
			$('#loadmore').css('display','block');
		});
	}
	$('#loadmore').click(function(e) {
        page++;
		$('#callpro').append('<p style="text-align:center" id="wait"><img src="<?php echo $url_dir; ?>images/loading.gif"></p>');
		$.post('<?php echo $url; ?>getnews.php?n='+page, $('#frmSearch').serialize(),function(data){
			$('#callpro').find('#wait').remove();
			if(!$.trim(data)){
				$('#loadmore').css('display','none');
				page=1;
				
			}
			else{
				$('#callpro').append(data);
				$('#loadmore').css('display','block');
			}
		});
    });
});

</script>
<section class="topGreyZone clearfix">
        <section class="itq-wrapper clearfix">
            <form  id="frmSearch">
                <ul class="clearfix">
                	<li>
                        <input  type="input" name="tukhoa" id="tukhoa" name="tukhoa"/>
                         
                        <label for="tukhoa">Tìm kiếm</label>
                    </li>
					<?php
                        foreach($category as $item)
                        {
                            if(is_array($item))
                            {
                    ?>
                             <li>
                                <input 
                                    type="checkbox" 
                                    name="<?php echo $lib->maketitle($item['title']) ?>" 
                                    id="<?php echo $lib->maketitle($item['title']) ?>"/>
                                <label for="<?php echo $lib->maketitle($item['title']) ?>">
									<?php echo $item['title']; ?>
                                </label>
                             </li>
                        
                    <?php
                            }
                        }
                      ?>  
                   
                </ul>
            </form>
        </section>
    </section><!--end .topGreyZone-->